package weak_20241227_29.stream;

import java.util.ArrayList;
import java.util.Optional;

/**
 * @author zdl
 * @date 2024/12/27
 */
public class Demo9 {
    public static void main(String[] args) {
        //9. 找出整数列表中大于5的最小值
        ArrayList<Integer> list = new ArrayList<>();
        list.add(2);
        list.add(-9);
        list.add(9);
        list.add(-20);
        list.add(12);
        Optional<Integer> min = list.stream().filter(s -> s > 5).min((w1, w2) -> w1 - w2);
        System.out.println(min.get()); //9
    }
}
